package org.paic.d.test

import org.paic.d.NamingStyleUtils as Style
import groovy.sql.GroovyRowResult

class NamingStyleUtilsTest extends GroovyTestCase {

	void testToCamal() {
		assert null == Style.toCamel(null, true)

		assert 'a' == Style.toCamel('A', true)
		assert 'HiHi' == Style.toCamel('__hi_hi', true)

		assert 'hiHi' == Style.toCamel('hi_hi', true)
		assert 'HiHi' == Style.toCamel('hi_hi', false)
	}

	void testToUnderline() {
		assert null == Style.toUnderline(null)
		assert 'a' == Style.toUnderline('A')

		assert 'hi_hi' == Style.toUnderline('hiHi')
	}

	void testTransform(){
		def obj = new GroovyRowResult(['MAN_NAME': 'Kerry'])
		assert [manName: 'Kerry'] == Style.transform(obj)
	}

}